#include "Strategy.h"
#include "States/FullState.h"
#include "States/Ball.h"
#include "States/Player.h"

#include "PlayerParam.h"
#include "ServerParam.h"

MovementType InterceptAndKick::nextMovement()
{
    FullState::instance().mutex.lock();

    Ball aktB = FullState::instance().getBall();
    Player aktP = FullState::instance().getPlayer(PlayerParam::instance().getSide(), PlayerParam::instance().getNum());

    //printf("Player %d:", PlayerParam::instance().getNum());

    double relDist = aktP.dist(aktB);
    printf("relDist: %lf\n", relDist);
    FullState::instance().mutex.unlock();

    if (relDist <= ServerParam::KICKABLE_MARGIN)
    {
        printf("is kicking\n");
        return M_Kick1;
    }
    else
    {
        printf("is intercepting\n");
        return M_InterceptBall;
    }
}
